package view;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.HashMap;
import java.util.Properties;
import java.util.ResourceBundle;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

import model.LogModel;

public class ExportView extends JDialog {

	private static final long serialVersionUID = 1L;
	private LogModel model;
	private ResourceBundle rLabels;
	private Properties configFile;
	private JTabbedPane tTabs;
	private JPanel pPDFTab;
	private Container content;
	private JButton bExportPDF;
	private JButton bClose;
	private GridBagLayout grid;
	
	public ExportView(LogModel model) {
		this.model = model;
		grid = new GridBagLayout();
		
		bExportPDF = new JButton("Export");
		rLabels = model.getLabels();
		configFile = model.loadConfiguration();
		
		content = this.getContentPane();
		content.setPreferredSize(new Dimension(400, 300));
		this.setTitle(rLabels.getString("menuExport"));
		
		bClose = new JButton("Close");
		
		initTabs();
		
		
		

		
		content.add(tTabs, BorderLayout.NORTH);
		content.add(bClose, BorderLayout.SOUTH);
		
		this.pack();
	}
	
	public JButton getExportPDFButton() {
		return this.bExportPDF;
	}
	
	public void initTabs() {
		tTabs = new JTabbedPane();
		initPDFTab();
		tTabs.setPreferredSize(new Dimension(400, 250));
	}
	
	public void initPDFTab() {
		JLabel lExportPDF = new JLabel("<html><b>Export to PDF</b></html>");
		JLabel lTitle = new JLabel("Title:");
		JTextField tfTitle = new JTextField(20);
		pPDFTab = new JPanel();
		
		pPDFTab.setLayout(grid);
		GridBagConstraints c = new GridBagConstraints();
		c.ipadx = 2;
		c.ipady = 2;
		c.weightx = 1;
		c.weighty = 1;
		
		c.gridx = 0; c.gridy = 0; c.gridwidth = 3;
		pPDFTab.add(lExportPDF, c);
		
		c.gridx = 0; c.gridy = 1; c.gridwidth = 1;
		pPDFTab.add(lTitle, c);
		
		c.gridx = 1; c.gridy = 1; c.gridwidth = 2;
		pPDFTab.add(tfTitle, c);
		
		c.gridx = 0; c.gridy = 2; c.gridwidth = 3;
		pPDFTab.add(bExportPDF, c);
		
		tTabs.addTab("PDF", pPDFTab);
	}
	
	public HashMap<String, String> getExportParams() {
		return null;
	}

}
